package com.demo.shoppingcart.bean;

import com.taobao.item.constant.content.Sku;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author liangliang 购物项
 */
public class ShoppingItem implements Serializable {
    private static final long serialVersionUID = 8113471649451303777L;

    // SKU 对象
    private Sku sku;

    // 是否有货
    private Boolean isHave = true;

    // 购买的数量
    private Integer amount = 1;

    public Sku getSku() {
        return sku;
    }

    public void setSku(Sku sku) {
        this.sku = sku;
    }

    public Boolean getHave() {
        return isHave;
    }

    public void setHave(Boolean have) {
        isHave = have;
    }

    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) { return true; }
        if (o == null || getClass() != o.getClass()) { return false; }
        ShoppingItem that = (ShoppingItem)o;
        if(sku==null){
            if(that.sku==null) {
                return false;
            }
        }else if(!sku.getId.equ)
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        return result * prime + (sku == null ? 0 : sku.hashCode());
    }
}
